#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 50;
const int M = 1e9 + 7;

int t, k;
string s;

set<int> s1{1, 4, 6, 8, 9};
set<int> s2{25, 27, 32, 35, 52, 57, 72, 75, 22, 33, 55, 77};


int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> t;
    while (t--)
    {
        cin >> k >> s;
        bool flag = false;
        for (int i = 0; i < k; i++)
        {
            int d = s[i] - '0';
            if (s1.find(d) != s1.end())
            {
                cout << 1 << endl
                     << d << endl;
                flag = true;
                break;
            }
        }

        if (flag)
            continue;

        // 25 27 32 35 52 57 72 75
        for (int i = 0; i < k; i++) {
            int d1 = s[i] - '0';
            for (int j = i+1; j < k; j++) {
                int d2 = s[j] - '0';
                if (s2.find(d1*10+d2) != s2.end()) {
                    cout << 2 << endl;
                    cout << d1 << d2 << endl;
                    goto retry;
                }
            }
        }

        retry:{}

    }
    return 0;
}